<?php
/**
 * Created by PhpStorm.
 * User: chenjia
 * Date: 2018/4/11
 * Time: 17:00
 */
namespace App\Admin\Extensions;
use Encore\Admin\admin;

class Check
{
    protected $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

    protected function script()
    {
        return <<<SCRIPT

$('.grid-check-row').on('click', function () {
    swal({
      title: "123",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "确定",
      closeOnConfirm: false,
      cancelButtonText: "取消"
    },
    function(){
        
    });
});


SCRIPT;
    }

    protected function render()
    {
        Admin::script($this->script());

        return "<a class='fa fa-check grid-check-row' data-id='{$this->id}'></a>";
    }

    public function __toString()
    {
        return $this->render();
    }
}